package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(100);"`
	Password string `gorm:"type:varchar(32);"`
}

func (u *User) FindUserByUsername(username string) (*User, error) {
	err := DB.Where("username=?", username).Find(&u).Error
	if err != nil {
		return nil, err
	}
	return u, nil
}
